package project.menu.garagemenu;

import api.controller.IAutoservice;
import project.controllers.Controller;
import project.controllers.Messager;
import project.controllers.Printer;
import project.menu.IMenu;
import project.menu.IMenuItem;
import project.work.Navigator;

public class NumberFreePlacesOnDate implements IMenuItem {

	private String name = "Get number free places on date";
	private final Integer id = 2;
	private static IMenu submenu;	
	private Controller controller;
	private Navigator navigator;
	
	public NumberFreePlacesOnDate(){
		controller=Controller.getInstance();
		navigator=Navigator.getInstance();
	}

	
	public static void setSubmenu(IMenu menu){
		 submenu=menu;
	}
	
	public void action(IAutoservice autoservice){
		int numberPlace=autoservice.getFreePlacesOnDate(controller.getDate());
		Printer.printMessage(numberPlace+Messager.NUMBER_GARAGE_ON_DATE);
		navigator.drawMenu(submenu);
	}

	
	public String getNameItem() {
		return name;
	}

	public Integer getId(){
		return id;
	}
}
